﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace NSDecisionTree.Gui
{
    public partial class SelectRootElement : Form
    {
        private string rootElement = String.Empty;

        public string RootElement
        {
            get { return rootElement; }
        }

        public SelectRootElement()
        {
            InitializeComponent();
        }

        public SelectRootElement(DataTable dt)
        {
            InitializeComponent();
            dt.Columns.RemoveAt(dt.Columns.Count - 1);
            foreach (DataColumn element in dt.Columns)
            {
                comboBox1.Items.Add(element.ColumnName);
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            rootElement = (string)comboBox1.SelectedItem;
            this.Close();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            rootElement = String.Empty;
            this.Close();
        }
    }
}
